<template>
  <div>
    <!-- 三级联动全局组件:三级联动组件已经是全局组件了，不需要引入,直接使用 -->
    <TypeNav></TypeNav>
    <ListContainer></ListContainer>
    <Recommend></Recommend>
    <Rank></Rank>
    <Like></Like>
    <!-- Floor这个组件:自己在组件内部是没有发请求的，数据是父组件给的 -->
    <Floor v-for="(floor) in getFloorList" :key="floor.id" :list="floor"></Floor>
    <Brand></Brand>
  </div>
</template>

<script>
// 引入其他组件
import ListContainer from '@/pages/Home/ListContainer/index.vue'
import Recommend from '@/pages/Home/Recommend/index.vue'
import Rank from '@/pages/Home/Rank/index.vue'
import Like from '@/pages/Home/Like/index.vue'
import Floor from '@/pages/Home/Floor/index.vue'
import Brand from '@/pages/Home/Brand/index.vue'

import {mapState} from 'vuex'

export default {
  name:'Home',
  components:{
    ListContainer,
    Recommend,
    Rank,
    Like,
    Floor,
    Brand
  },
  mounted() {
    // 派发action，获取floor组件的数据
    this.$store.dispatch('getFloorList')
  },
  computed:{
    ...mapState({
      getFloorList: (state) => {
        return state.home.getFloorList;
      },
    })
  },

}
</script>

<style>

</style>